const poolm = require('./mysql/' + process.env.NODE_ENV) || {}
const mysql = require("mysql2");
const pool = mysql.createPool(poolm)
function exect(sql: any) {
    //抛出promise对象
    return new Promise((resolve, reject) => {
        pool.query(sql, (err:any, data:any) => {
            //判断
            if (err) {
                reject(err);
            } else {
                resolve(data);
            }
        })
    })
}

module.exports = { exect }
